﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OnlineStore.Bll;
using OnlineStore.Dal;

namespace OnlineStore.Gui
{
    public partial class ProductDetail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string ID = Request.QueryString.Get("id");
            bizProduct _bizproduct = new bizProduct();
            tbProduct _product = _bizproduct.SearchPorduct(ID);
            if (_product == null)
                Product_find.Visible = true;
            else
            {
                lb_Title.Text = _product.Product_Name;
                string img = "../img/" + _product.Picture;
                img = img.Trim();
                HL_Img_product.NavigateUrl = img;
                Image_product.ImageUrl = img;
                lb_price.Text = String.Format("{0:0,0 VNĐ}", _product.Price);
                if (_product.Stock_Qty > 1)
                    lb_Status.Text = _product.Stock_Qty.ToString();
                else
                    lb_Status.Text = "Hết Hàng";
                lb_Type.Text = _product.Type;
                lb_Color.Text = _product.Color;
                lb_Introduce.Text = _product.Introduce;
                lb_Detail.Text = _product.Detail;

                
            }
            DalProduct _DalProduct = new DalProduct();
            mainlist.DataSource = _DalProduct.Outstanding();
            mainlist.DataBind();
        }
    }
}